package HospitalApplication;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class RandezvousApplications implements Applications{
	
	private static Map <String, Randezvous> randezvousMap = new HashMap();
	
	@Override
	public boolean add(Person p) {
		if(p instanceof Randezvous) {
			randezvousMap.put(p.id, (Randezvous) p);
		}
		return false;
	}

	@Override
	public void printDetail(Person p) {
		if (p instanceof Randezvous) {
			Randezvous r = (Randezvous) p;
			System.out.println("-------------------------");
			System.out.println("ID : " + r.id);
			System.out.println("Doctor : " + r.doc.name);
			System.out.println("Patient : " + r.pat.name);
			System.out.println("Problem : " + r.problem);
			System.out.println("Date : " + r.date);
			System.out.println("-------------------------");
		}
		else
			System.out.println("This is not a valid randezvous!");
		
		
	}

	@Override
	public void printDetail(List<Person> PList) {
		for (Person person : PList) {
			printDetail(person);
		}
		
	}

	@Override
	public void printAll() {
		for (Map.Entry entry : randezvousMap.entrySet()) {
			printDetail((Randezvous) entry.getValue());
		}
		
	}
	
}
